<?php
$_doc = array();
$_doc['title'] = L('tab_category_list');
$_doc['extra'] = '<link rel="stylesheet" type="text/css" href="'.__CURRENT__.'/pCategory.css" />'.
                '<script type="text/javascript">var imgBasePath="'.__CURRENT__.'/../pAdmin/img/tree/";</script>'.
                '<script type="text/javascript" src="'.__CURRENT__.'/pCategory.js"></script>';
?>
<include file="pAdmin:header" />
<table class="tabmenu" cellspacing="0">
    <tbody>
        <tr>
            <td class="wedge">&nbsp;</td>
            <td class="wmenu here"><a href="__URL__/"><span>{%tab_category_list}</span></a></td>
            <td class="wmenu"><a href="__URL__/add"><span>{%tab_category_add}</span></a></td>
            <td class="wmenu"><a href="__URL__/allocate"><span>{%tab_category_allocate}</span></a></td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
</table>
<div class="main">
    <script type="text/javascript">
        var Nodes=[];
    </script>
    <form name="mainForm" method="get" action="__URL__">
        <input type="hidden"  name="a"/>
        <table class="data">
            <thead>
                <tr>
                    <th style="padding-left:24px;">{%column_name}</th>
                </tr>
            </thead>
            <tbody class="grid" id="tree">
            <?php
            $add_sub=L('action_add_sub');
            $alter=L('action_alter');
            $move=L('action_move');
            $removal=L('action_removal');
            ?>
            <iterate name="allCategorys" id="vo">
                <tr>
                    <td id="node{$vo['id']}" class="st">
                        <if condition="$vo['jump'] neq ''">
                            {$vo['name']}
                            <a href="{$vo['jump']}" target="_blank"><img class="imgJump"
                                src="__TMPL__../Admin/pCategory/jump.png"
                                title="{$jump}" alt="{$jump}"/></a>
                            <span>
                                <a href="javascript:alterCategory({$vo['id']})">{$alter}</a>
                                <a href="javascript:moveCategory({$vo['id']})">{$move}</a>
                                <a href="javascript:removeCategory({$vo['id']})">{$removal}</a>
                            </span>
                        <else />
                            {$vo['name']}
                            <span>
                                <a href="javascript:addChildCategory({$vo['id']})">{$add_sub}</a>
                                <a href="javascript:alterCategory({$vo['id']})">{$alter}</a>
                                <a href="javascript:moveCategory({$vo['id']})">{$move}</a>
                                <a href="javascript:removeCategory({$vo['id']})">{$removal}</a>
                            </span>
                        </if>
                        <script type="text/javascript">
                        var tmp_node={ id:{$vo['id']},level:{$vo['ply']},lft:{$vo['lft']},rgt:{$vo['rgt']},lastInLayer:false };
                        tmp_node.count=(tmp_node.rgt-tmp_node.lft-1)/2;
                        Nodes.push(tmp_node);
                    </script>
                    </td>
                </tr>
            </iterate>
            </tbody>
        </table>
        <script type="text/javascript">
            function addChildCategory(catid){
                window.location='__URL__/add&id='+catid;
            }
            function alterCategory(catid){
                window.location='__URL__/edit&id='+catid;
            }
            function moveCategory(catid){
            }
            function removeCategory(catid){
            }
        </script>
    </form>
</div>
<include file="pAdmin:footer" />